<?php
class Member extends ActiveRecord{
	
	public function initialize(){
		//Asociar con tabla de la bd
		$this->source = "qo_members";
		//$this->has_and_belongs_to_many("group", "fk: qo_groups_id", "key: qo_members_id", "through: qo_groups_has_members");
		
		//Asociaciones
		$this->has_many("group_has_member", "fk: qo_members_id");
		
		//Validaciones
		$this->validates_email_in('email_address', 'field: email');
		$this->validates_length_of('email_address', '55', '0', 'field: email');
		$this->validates_length_of('first_name', '25', '0', 'field: nombre');
		$this->validates_length_of('last_name', '35', '0', 'field: apellido');
		$this->validates_length_of('password', '255', '0', 'field: clave');
		$this->validates_length_of('locale', '5', '0', 'field: local');
		$this->validates_presence_of('active', 'field: activo');
		$this->validates_presence_of('first_name', 'field: nombre');
		$this->validates_presence_of('last_name', 'field: apellido');
		$this->validates_presence_of('email_address', 'field: email');
		$this->validates_presence_of('password', 'field: clave');
		$this->validates_inclusion_in('active', array('1', '0'), 'field: activo');
	}
	
}
?>